<?php

namespace App\Enums;

use App\Traits\EnumTrait;

/**
 * 小程序菜单板块枚举
 * @method static string getName($value)
 * Class AppMiniPlateEnum
 */
class SmsTempEnum extends \PhpEnum\PhpEnum
{
    use EnumTrait;
    // 下单成功通知
    public const ORDER_PLACED = 'order_placed';

    // 订单审核通过通知
    public const ORDER_APPROVED = 'order_approved';

    // 订单审核失败通知
    public const ORDER_REJECTED = 'order_rejected';

    // 确认信息通知
    public const CONFIRM_ORDER_INFO = 'confirm_order_info';

    // 下单待支付通知
    public const PENDING_PAYMENT = 'pending_payment';

    // 发货前注意事项提醒
    public const BEFORE_SHIPMENT_REMINDER = 'before_shipment_reminder';

    // 已发货通知
    public const SHIPPED_NOTIFICATION = 'shipped_notification';

    // 取消订单通知
    public const ORDER_CANCELLED = 'order_cancelled';

    // 订单到期提前通知
    public const PAYMENT_DUE_SOON = 'payment_due_soon';

    // 当日订单到账通知
    public const PAYMENT_DUE_TODAY = 'payment_due_today';

    // 订单到期支付失败
    public const PAYMENT_FAILED = 'payment_failed';

    /**
     * 获取所有短信模板类型
     *
     * @return array
     */
    public static function all()
    {
        return [
            self::ORDER_PLACED,
            self::ORDER_APPROVED,
            self::ORDER_REJECTED,
            self::CONFIRM_ORDER_INFO,
            self::PENDING_PAYMENT,
            self::BEFORE_SHIPMENT_REMINDER,
            self::SHIPPED_NOTIFICATION,
            self::ORDER_CANCELLED,
            self::PAYMENT_DUE_SOON,
            self::PAYMENT_DUE_TODAY,
            self::PAYMENT_FAILED,
        ];
    }

    /**
     * 根据键名获取对应的中文描述
     *
     * @param string $key
     * @return string|null
     */
    public static function getDescription($key)
    {
        $descriptions = [
            self::ORDER_PLACED => '下单成功通知',
            self::ORDER_APPROVED => '订单审核通过通知',
            self::ORDER_REJECTED => '订单审核失败通知',
            self::CONFIRM_ORDER_INFO => '确认信息通知',
            self::PENDING_PAYMENT => '下单待支付通知',
            self::BEFORE_SHIPMENT_REMINDER => '发货前注意事项提醒',
            self::SHIPPED_NOTIFICATION => '已发货通知',
            self::ORDER_CANCELLED => '取消订单通知',
            self::PAYMENT_DUE_SOON => '订单到期提前通知',
            self::PAYMENT_DUE_TODAY => '当日订单到账通知',
            self::PAYMENT_FAILED => '订单到期支付失败',
        ];

        return $descriptions[$key] ?? null;
    }

}
